//
//  CartPresentView.m
//  JiaoX
//
//  Created by jiaoxiu－005 on 15/2/2.
//  Copyright (c) 2015年 北京娇羞科技有限公司. All rights reserved.
//

#import "CartPresentView.h"
#define PRESENT_NAME_SIZE [DimensUtils getScaleX:12]

@interface CartPresentView()
{
    UIImageView *_presentIcon;
    UILabel *_presentDescLabel;
}
@end

@implementation CartPresentView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        //1.赠品图标
        UIImageView *presentIcon = [[UIImageView alloc]init];
        UIImage *presentImg  = [UIImage imageNamed:@"cart_present_icon"];
        [presentIcon setImage:presentImg];
        [presentIcon setFrame:CGRectMake(0, 0, presentImg.size.width, presentImg.size.height)];
        _presentIcon = presentIcon;
        [self addSubview:presentIcon];
        
        //2.赠品描述
        UILabel *presentDescLabel = [[UILabel alloc]init];
        [presentDescLabel setFont:[UIFont systemFontOfSize:PRESENT_NAME_SIZE]];
        [presentDescLabel setTextColor:JXColor(102, 102, 102)];
        [presentDescLabel setFrame:CGRectMake(CGRectGetMaxX(_presentIcon.frame)+5, 0, JXScreenW-CGRectGetMaxX(_presentIcon.frame)-JXPublicInset*2, presentImg.size.height)];
        [presentDescLabel setTextAlignment:NSTextAlignmentLeft];
        _presentDescLabel = presentDescLabel;
        [self addSubview:presentDescLabel];
        
        //设置自己
        [self setBounds:CGRectMake(0, 0, JXScreenW-JXPublicInset*2,presentImg.size.height)];
    }
    return self;
}

-(void)setPresentDesc:(NSString *)presentDesc
{
    [_presentDescLabel setText:presentDesc];
}

@end
